package com.army.study.utils;

import ohos.app.AbilityContext;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class DeviceUtils {
    private DeviceUtils() {

    }

    public static List<String> getFile(AbilityContext context) {
        if (context.getDistributedDir() == null) {
//            WidgetHelper.showTips(context, "分布式异常");
            return new ArrayList<>();
        }

        File file = new File(context.getDistributedDir().getPath());
        File[] files = file.listFiles();

        if (files == null) {
            return new ArrayList<>();
        }

        List<String> lists = new ArrayList<>();
        for (File eachFile : files) {
            lists.add(eachFile.getPath());
        }
        return lists;
    }
}
